<?php
/*
 * @Author: your name
 * @Date: 2021-11-02 19:06:50
 * @LastEditTime: 2022-02-19 19:12:29
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /nlog/app/Models/admin_model/Admin.php
 */

namespace App\Models\daily_partTime;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class User extends Model
{
    use HasFactory;
    static string $tableName = 'daily_partTime_user';

    public static function   insertUpdated($formDataStr){
        // echo "INSERT INTO ".self::$tableName." ( ".$formDataStr['keyStr'].",update_time,create_time) VALUES ( ".$formDataStr['valStr'].",NOW(),NOW() ) ON DUPLICATE KEY UPDATE ".$formDataStr['updateStr'].",update_time = now() ";
       return   DB::update("INSERT INTO ".self::$tableName." ( ".$formDataStr['keyStr'].",update_time,create_time) VALUES ( ".$formDataStr['valStr'].",NOW(),NOW() ) ON DUPLICATE KEY UPDATE ".$formDataStr['updateStr'].",update_time = now() ");
    }


    public static function  loginId($openid){
        return DB::table(self::$tableName)->where(['openid' => $openid])->first();
         
   
        //   $res ;
    }

   
}
